package hr.eon.server.message;

import hr.eon.core.EonMessage;
import hr.eon.core.message.handler.EonHandler;
import hr.eon.server.EonContext;

/**
 * Message dispatcher which consume received JMS message and load correspond
 * handler and raise handle event.
 * 
 * @author mjovanovic
 * @since 0.0.1
 */
public class MessageDispatcher {

    public EonMessage dispatch( EonMessage message ) {
        EonHandler handler = (EonHandler) EonContext.getMessageHandler( message.getClazz() );
        return handler.handle( message );
    }

}
